home *** CD-ROM | disk | FTP | other *** search
- /* Algorithm:
- * We keep a count called "changed"; initially, "changed=0".
- * We also keep three timers, called "busy", "sleeping", and "running."
- * Initially none of them are running.
- * (We set these to zero when they're not supposed to be running.
- * If we're told that one has gone off, we check that it's not zero.)
- * If "busy" is running, we "are busy."
- * If "sleeping" is running, we "are asleep."
- * If "running" is running, we "are running."
- * So much for the state. 5 things can happen: 1: keystroke, 2: tex is done,
- * 3: running times out, 4: busy times out, 5: sleeping times out.
- *
- * When user types:
- * If the text is empty, we set "changed" to 0.
- * If it's not empty, we set "changed" to 2.
- * If we are running or we are asleep, that's all.
- * Otherwise:
- * if we are busy we stop "busy".
- * Then we start "busy."
- * If "busy" times out:
- * We stop "busy".
- * If we are not "running" and not "sleeping" and "changed" we start TeX.
- * When we start TeX, we decrement "changed" and start "running"
- * If "running" goes off, we kill TeX (and thus TeX stops).
- * When TeX stops, we stop "running".
- * If "changed", we start "sleeping".
- * If "sleeping" goes off, we stop "sleeping."
- * Then if changed > 0 we start TeX.
- */
-